|
|
 |
|
|
|
|
lstKeys.Clear
For intLoop = LBound(astrKeys) To UBound(astrKeys)
lstKeys.AddItem astrKeys(intLoop)
Next
Set oReg = Nothing
End Sub |
|
|
|
|
|
|
|
|
In this code, you need to declare an array of variants. The ConfigName and Section properties of the Registry class are then filled in. When the SectionGet() method is called, it returns a Variant array of strings. The code then loops through this array and loads the keys and values into a list box. |
|
|
|
|
|
|
|
|
The SectionGet() Method in the Registry Class |
|
|
|
|
|
|
|
|
The SectionGet() method accepts an optional argument of which section to get keys from. This method creates a Variant array that returns a two-dimensional array from the GetAllSettings() function. Instead of having a two-dimensional array returned, I like to have a single-dimensional array returned with the keyed pair in each element. Therefore, after retrieving the array from the GetAllSettings() function, I loop through the array and convert it to a single-dimensional array by concatenating the value in the first element with an equal sign and the value in the second element. Heres an example: |
|
|
|
 |
|
|
|
|
Public Function SectionGet( _
Optional strSection As String = "") _
As Variant()
Dim lngRet As Long
Dim astrAll As Variant
Dim astrKeys() As String
Dim intLoop As Integer
If strSection <> "" Then
mstrSection = strSection
End If
If mstrSection <> "" Then astrAll = GetAllSettings(mstrConfigName, mstrSection) If Not IsEmpty(astrAll) Then |
|
|
|
|
|